package com.qfdu.repo.common;

import com.alibaba.fastjson.JSON;
import com.qfdu.repo.bean.RespResult;


public class JSONUtils {

    public static String toJSONString(RespResult result){
        return JSON.toJSONString(result);
    }

    public static String toJSONString(int code,String msg){
        return toJSONString(code,msg,null);
    }

    public static String toJSONString(int code,String msg,Object data){
        RespResult result = new RespResult();
        result.setCode(code);
        result.setMsg(msg);
        result.setRepo(data);
        return toJSONString(result);
    }

    public static<T> T parseObject(String jsonString,Class<T> clz){
        return JSON.parseObject(jsonString, clz);
    }
}
